package com.chmingx.boot.bean;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @Component
 * @ConfigurationProperties("mycar")
 *
 * 等价于
 *
 * @EnableConfigurationProperties(Car.class)  在配置类上加注解
 * @configurationProperties("mycar")
 *
 * 1. 开启Car配置绑定功能
 * 2. 把这个Car这个组件自动注册到容器中
 */
@Component
@ConfigurationProperties(prefix = "mycar") // 读取properties文件信息，自动装配
public class Car {
    private String brand;
    private double price;
}
